import 'package:rxdart/rxdart.dart';
import 'package:loxen/api/http_server/file_change_delete_add_select.dart';
import 'package:loxen/api/http_server/file_show.dart';
import 'package:loxen/mode/master/master_index_bean.dart';
import 'package:loxen/viewmode/base_view_model.dart';



class MasterIndexViewModel extends BaseViewModel
    with FileChangeDeleteAddSelectMixin, FileShowMixin {
  FileShow bean;

  void loadData() {
    showFile().doOnListen(() {
      mState = BaseState.LOADING;
      notifyListeners();
    }).listen((event) {
      if (event != null && event.article.length > 0) {
        bean = event;
        mState = BaseState.CONTENT;
      } else {
        mState = BaseState.EMPTY;
      }
      notifyListeners();
    }, onError: (error, tick) {
      print(error);
      print(tick);
      mState = BaseState.FAIL;
      notifyListeners();
    });
  }

}
